//
//  LZBaseVC.swift
//  halikaPeso
//
//  Created by L-zh on 2024/12/18.
//

import UIKit
import SnapKit
import JXCategoryView

class LZBaseVC: UIViewController {
    open var viewModel: LZBaseViewModel!
    open var customView:LZBaseView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupViewModel()
        setupUI()
        setupData()
        
    }
    
    public func setupViewModel() {
        self.viewModel = LZBaseViewModel(viewController: self)
        self.customView = LZBaseView(frame: CGRect.zero, viewController: self)
    }
    
    public func setupUI(){
        view.backgroundColor =  UIColor.white
        view.addSubview(customView)
        customView.snp.makeConstraints { (make) in
            if #available(iOS 11.0, *) {
                make.edges.equalTo(self.view.safeAreaLayoutGuide)
            } else {
                // Fallback on earlier versions
                make.edges.equalTo(self.view)
            }
        }
        if #available(iOS 11.0, *) {
            UIScrollView.appearance().contentInsetAdjustmentBehavior = .never
        } else {
            // Fallback on earlier versions
            self.automaticallyAdjustsScrollViewInsets = false
        }
    }
    public func setupData(){}
    
    public func injectionIIIAction() {
        viewModel.injectionIIIAction()
        customView.injectionIIIAction()
    }
}
